using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;

namespace UniversalAdmin.Domain.Entities;

[Table("operation_logs")]
public class OperationLog : EntityBase
{
  [Column("user_id")]
  public int? UserId { get; set; }

  [ForeignKey("UserId")]
  public virtual User? User { get; set; }

  [Required]
  [MaxLength(100)]
  [Column("action")]
  public string Action { get; set; } = null!;

  [MaxLength(100)]
  [Column("resource")]
  public string? Resource { get; set; }

  [Column("resource_id")]
  public int? ResourceId { get; set; }

  [Column("ip_address", TypeName = "inet")]
  public string? IpAddress { get; set; }

  [Column("user_agent")]
  public string? UserAgent { get; set; }
}